﻿//--------------------------------------------------------------------------------------------------------------------------------------------------------
// <copyright file="HomeController.cs">
//     Copyright © 2010 Oli Francis
//     This source code is subject to the terms and conditions of the MIT license. A copy of the license can be found in the license.txt 
//     file at the root of this distribution. By using this source code in any fashion, you are agreeing to be bound by the terms of the MIT License. 
//     You must not remove this notice from the software.
// </copyright>
// <author>Oli</author>
//-------------------------------------------------------------------------------------------------------------------------------------------------------

namespace TeamBrain.Web.Controllers
{
    #region Using Statements

    using System.Web.Mvc;

    using TeamBrain.Domain.Core;
    using TeamBrain.Domain.Core.Repositories;
    using TeamBrain.Domain.Model;

    #endregion

    /// <summary>
    /// The home controller.
    /// </summary>
    public class HomeController : Controller
    {
        private readonly IRepository<Site> siteRepository;

        /// <summary>
        /// Initializes a new instance of the <see cref="HomeController"/> class.
        /// </summary>
        public HomeController(IRepository<Site> siteRepository)
        {
            this.siteRepository = siteRepository;
        }

        #region Public Methods

        /// <summary>
        /// Handles a get request for the default action
        /// </summary>
        public ActionResult Index()
        {
            // ViewData["Welcome"] = this.customerRepository.WelcomeMessage;
            var sites = this.siteRepository.ListAll();

            var site = new Site { Name = "NewOne" };

            return View(sites);
        }

        #endregion
    }
}